﻿@{
    ViewBag.Title = "View Loads";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="~/js/load.js"></script>
<script src="/js/tabletocsv.js"></script>
<div id="div-driverloadsreport" class="modal hide fade" data-width="1000" tabindex="-1" role="dialog" aria-labelledby="addController" aria-hidden="true">
    <div class="container-fluid">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h5>Driver Loads Report <a href="javascript:;" onclick="$('#box-date').slideToggle();" style="font-size: 12px;">(Change Date)</a></h5>
        </div>
        <div class="modal-body">
            <div class="container-fluid">
                <div class="row-fluid" id="box-date" style="display: none;">
                    <form id="fr-driverloadsreport" method="POST" class="margin0" action="/load/DriverLoadsReport">
                        <div class="span1 text-right" style="padding-top: 5px;">Start</div>
                        <div class="span3">
                            <div class="input-append datetimepicker">
                                <input type="text" name="startdate" id="startdate" value="@(Request["startdate"] ?? DateTime.Now.ToString("dd/MM/yyyy"))" data-format="dd/MM/yyyy" class="input-block-level" />
                                <span class="add-on">
                                    <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                                </span>
                            </div>
                        </div>
                        <div class="span1 text-right" style="padding-top: 5px;">End</div>
                        <div class="span3">
                            <div class="input-append datetimepicker">
                                <input type="text" name="enddate" id="enddate" value="@(Request["enddate"] ?? DateTime.Now.AddDays(1).ToString("dd/MM/yyyy"))" data-format="dd/MM/yyyy" class="input-block-level"  />
                                <span class="add-on">
                                    <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                                </span>
                            </div>
                        </div>
                        <div class="span2 text-right">
                            <input type="submit" value="Filter" class="btn btn-primary w90" />
                        </div>
                    </form>
                </div>
                <div class="row-fluid">
                    <div class="span12 text-right">
                        <button class="btn btn-info w90" type="button" onclick="ExportCSVWithHead($('.tbody'), 'Table.csv', $('.thead'))">
                            <img src="/img/icon-exel.png" style="max-height: 20px">
                            Export</button>
                    </div>
                </div>
                <div class="row-fluid">
                    <input type="hidden" id="checkreport" value="0"/>
                    <div id="div-loadsreport" class="row-fluid" style="height: 329px;overflow: auto;">
                        <table class="table table-bordered table-fix tbl-loadsreport tbl-selected" data-height="280">
                            <thead class="thead">
                                <tr>
                                    <th>DriverID</th>
                                    <th>DriverName</th>
                                    <th>LoadID</th>
                                    <th>LoadCode</th>
                                    <th>PlannedDeliveryDate</th>
                                    <th>TotalOrders</th>
                                    <th>Weight</th>
                                    <th>ConfirmDelivered</th>
                                    <th>FailedDelivered</th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<form style="display: none" method="POST" action="/Load/UploadLoadImages" id="frUploadImageToLoad" enctype="multipart/form-data">
    <input type="file" name="FileUpload" style="float: right" id="inputUploadfile" onchange="$('#frUploadImageToLoad').submit()" />
    <input type="hidden" id="SelectedLoadId" name="loadid" value="" />
</form>
<form style="display: none" method="POST" action="/Load/UploadLoadImages" id="frUploadDeliveryNote" enctype="multipart/form-data">
    <input type="file" name="FileUpload" style="float: right" id="inputUploadDeliveryNote" onchange="$('#frUploadDeliveryNote').submit()" />
</form>
<div class="container-fluid">
    <div class="page-header">
    </div>
    <div class="fieldset">
        <div class="legend"><span>Load Status Summary</span></div>
        <div class="row-fluid">
            <div class="span10">
                <div class="row-fluid">
                    <div class="span2">UnPlanned Loads: <strong class="TotalUnplannedLoad">@ViewBag.TotalUnplannedLoad</strong></div>
                    <div class="span2">Re-Plan Loads: <strong class="TotalReplanLoads">@ViewBag.TotalReplanLoads</strong></div>
                    <div class="span2">Planned Loads: <strong class="TotalPlannedLoads">@ViewBag.TotalPlannedLoads</strong></div>
                    <div class="span2">Booked In Loads: <strong class="TotalBookedInLoads">@ViewBag.TotalBookedInLoads</strong></div>
                    <div class="span2">Picked Loads: <strong class="TotalPickedLoads">@ViewBag.TotalPickedLoads</strong></div>
                    <div class="span2">Despatched Loads: <strong class="TotalDespatchedLoads">@ViewBag.TotalDespatchedLoads</strong></div>
                </div>
            </div>
            <div class="span2 text-right">
                <button class="btn btn-primary" type="button" onclick="viewloadrefreshsummary()">Refresh Summary</button>
            </div>
        </div>
    </div>
    <div class="fieldset">
        <div class="legend"><span>Loads</span></div>
        <form action="/load/searchlistloaddetail" method="POST" class="margin0" id="fr-searchlistloaddetail">
            <div class="row-fluid">
                <div class="span8">
                    <div class="row-fluid">
                        <div class="span2">Load Status</div>
                        <div class="span3">
                            @Html.DropDownList("LoadStatusID", null, new { @class = "input-block-level", @onchange = "changeLoadStatus()" })
                        </div>
                        <div class="span2">SpecialCondition</div>
                        <div class="span3">
                            <select id="specialcondition" class="input-block-level">
                                <option value="none">None</option>
                                <option value="createdtoday">Created Today</option>
                                <option value="mustbedeliveredtoday">Must be Delivered Today</option>
                            </select>
                        </div>
                        <div class="span2">
                            <input type="submit" class="btn btn-primary" value="Search" style="width: 100%" />
                        </div>
                    </div>
                </div>
                <div class="span4 text-right">
                    <input type="button" class="btn btn-info" value="Manager Delivery Note" style="width: 160px" onclick="if ($('#SelectedLoadId').val() != '') { PopupCenter('/orderview/ManagerDeliveryFiles?loadid=' + $('#SelectedLoadId').val(), 1200, 600) }" />
                    <input type="button" class="btn btn-info" value="Import Delivery Note" style="width: 160px" onclick="if ($('#SelectedLoadId').val() != '') { $('#inputUploadDeliveryNote').click(); }" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span8">
                    <div class="row-fluid">
                        @*<div class="span2">Date Create</div>
                        <div class="span3">
                            <div class="input-append datetimepicker">
                                <input data-format="dd/MM/yyyy" type="text" name="datecreate" style="width: 70%" value="@string.Format("{0:dd/MM/yyyy}", DateTime.Now)">
                                <span class="add-on">
                                    <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                                </span>
                            </div>
                        </div>*@
                        <div class="span2">Load Code</div>
                        <div class="span3">
                            <input type="text" class="input-block-level" name="loadcode" />
                        </div>
                        <div class="span2">Driver Name</div>
                        <div class="span3">
                            @Html.DropDownList("DriverID", null, new { @class = "input-block-level" })
                        </div>
                    </div>
                </div>
                <div class="span4 text-right">
                    <input type="button" class="btn btn-info" value="Upload Image To Orders" style="width: 160px" onclick="if ($('#SelectedLoadId').val() != '') { PopupCenter('/load/addimagetoorder?loadid=' + $('#SelectedLoadId').val(), 1200, 600); }" />
                    <input type="button" class="btn btn-info" value="Upload Image" style="width: 160px" onclick="if ($('#SelectedLoadId').val() != '') { $('#inputUploadfile').click(); }" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span8">
                    <div class="row-fluid">
                        <div class="span2">Load ID</div>
                        <div class="span3">
                            <input type="text" class="input-block-level" name="loadid" />
                        </div>
                        <div class="span2">Carrier</div>
                        <div class="span3">
                            @Html.DropDownList("carrierID", null, new { @class = "input-block-level" })
                        </div>
                    </div>
                </div>
                <div class="span4 text-right">
                    <a data-toggle="modal" href="#div-driverloadsreport" class="btn btn-info" style="width: 142px;font-family: arial;" onclick="checkLoadsReport()">Loads Today</a>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span8">
                    <div class="row-fluid">
                        <div class="span2 box-disabled" style="display: none;">Date From</div>
                        <div class="span3 box-disabled" style="display: none;">
                            <div class="input-append datetimepicker">
                                <input data-format="dd/MM/yyyy" type="text" id="datefrom" style="width: 70%" value="">
                                <span class="add-on">
                                    <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                                </span>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </form>
        <input type="hidden" id="sort" value="asc" />
        <div class="listloaddetail">
            <table class="table table-bordered table-fix krmtable" data-height="250">
                <thead>
                    <tr>
                        <th>LoadID</th>
                        <th>LoadCode</th>
                        <th>LoadStatus</th>
                        <th>CreatedDate</th>
                        <th>Username</th>
                        <th>PlannedDeliveryDate</th>
                        <th>DespatchDate</th>
                        <th>CarrierName</th>
                        <th>DriverName</th>
                        <th>Name</th>
                        <th>LoadStatusID</th>
                        <th>CreateByUserID</th>
                        <th>VehicleID</th>
                        <th>CarrierID</th>
                        <th>DriverID</th>
                        <th>VehicleMaxWeight</th>
                        <th>ProcessOrder</th>
                        <th>IsZoned</th>
                    </tr>
                </thead>
            </table>
        </div>
    </div>
    <div class="fieldset">
        <div class="legend">
            <span>Load Detail</span>
        </div>
        <div class="listloaditemdetail">
            <div class="border-padding10">
                <div class="row-fluid">
                    <div class="span2">
                        <h3 style="margin: 0; line-height: normal">Empty</h3>
                    </div>
                    <div class="span3">Total Packages: 0</div>
                </div>
                <div class="row-fluid">
                    <div class="span2">
                        Qty Item: 0
                    </div>
                    <div class="span3">Total Weight: 0</div>
                    <div class="span1">Vehicle</div>
                    <div class="span3">
                        <select class="input-block-level"></select>
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span2">
                        Create By: 
                    </div>
                    <div class="span3">Vehicle Max Wgt: 1340.00</div>
                    <div class="span1">Driver</div>
                    <div class="span3">
                        <select class="input-block-level"></select>
                    </div>
                    @*<div class="span4 text-right">
                        <input type="button" class="btn btn-info" value="Generate Costs" />
                        <input type="button" class="btn btn-info" value="Export to AutoRoute" />
                    </div>*@
                </div>
            </div>
            <table class="table table-bordered table-fix krmtable" data-height="200">
                <thead>
                    <tr>
                        <th>Cancelled</th>
                        <th>Delivered</th>
                        <th>ItemStatus</th>
                        <th>OrderRef</th>
                        <th>PostCode</th>
                        <th>OrderItemID</th>
                        <th>Qty</th>
                        <th>Product</th>
                        <th>SpecialInstructions</th>
                        <th>WeightKG</th>
                        <th>Packages</th>
                        <th>Customer</th>
                        <th>Address</th>
                        <th>Telephone1</th>
                        <th>Telephone2</th>
                        <th>EmailAddress</th>
                        <th>ProductID</th>
                        <th>ProductOptionID</th>
                        <th>DatePlaced</th>
                        <th>WarehouseID</th>
                        <th>CarrierName</th>
                        <th>CarrierID</th>
                        <th>DropID</th>
                        <th>OrderID</th>
                        <th>LoadID</th>
                        <th>ItemCancelled</th>
                        <th>DropNumber</th>
                        <th>DeliveryDate</th>
                    </tr>
                </thead>
            </table>
            @*<div class="row-fluid" style="margin-top: 10px">
                <div class="span2">
                    <input type="button" class="btn btn-primary" value="Update Despatched" style="width: 100%; margin-bottom: 10px; height: 40px;" disabled="disabled"/>
                    <input type="button" class="btn btn-primary" value="Unplan Load" style="width: 100%; height: 40px;" disabled="disabled"/>
                </div>
                <fieldset class="span5" style="margin-top: -7px">
                    <legend><label><input type="checkbox" class="cbcheck"/> Delivery Documents</label></legend>
                    <div class="row-fluid">
                        <div class="span6">
                            <label><input type="checkbox" class="cbcheck"/> Picking Summary</label>
                        </div>
                        <div class="span6">
                            <label><input type="checkbox" class="cbcheck"/> Driver Manifest</label>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span6">
                            <label><input type="checkbox" class="cbcheck"/> Packing List</label>
                        </div>
                        <div class="span6">
                            <label><input type="checkbox" class="cbcheck"/> Delivery Notes</label>
                        </div>
                    </div>
                </fieldset>
                <div class="span5">
                    <div class="row-fluid">
                        <div class="span6">
                            <label><input type="checkbox" class="cbcheck"/> Box Labels</label>
                        </div>
                        <div class="span6">
                            <label><input type="checkbox" class="cbcheck"/> Driver Load Acceptance Summary</label>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span6">
                            <label><input type="checkbox" class="cbcheck" id="despatchlabels"/> Despatch Labels</label>
                        </div>
                        <div class="span6">
                            <label><input type="checkbox" class="cbcheck"/> Send email</label>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span6">
                            <label><input type="checkbox" class="cbcheck"/> Pallet Label</label>
                        </div>
                        <div class="span6">
                            <label><input type="checkbox" class="cbcheck"/> Returns Form</label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3">
                    <button type="button" class="btn btn-primary" style="width: 100%" disabled="disabled">1.<br />Pick selected order<br />(Generate Pick Notes)</button>
                </div>
                <div class="span3">
                    <button type="button" class="btn btn-primary" style="width: 100%; margin-bottom: 10px" disabled="disabled">1(a) Trunked</button>
                    <button type="button" class="btn btn-primary" style="width: 100%" disabled="disabled">1(b) At Hub</button>
                </div>
                <div class="span3">
                    <button type="button" class="btn btn-primary" style="width: 100%" disabled="disabled">2.<br />Despatch order<br />(Generate Delivery Note)</button>
                </div>
                <div class="span3">
                    <button type="button" class="btn btn-primary" style="width: 100%; height: 70px;" disabled="disabled">3.<br />Confirm Delivery</button>
                </div>
            </div>*@
        </div>
    </div>
</div>

<div id="ViewSendLoadDetail" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="ViewSendLoadDetail" aria-hidden="true">
    <div class="modal-body">
        @Html.Partial("SendLoadDetail")
    </div>
</div>
